Socket
Socket
Sign inDemoInstall

hast-util-whitespace

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hast-util-whitespace

hast utility to check if a node is inter-element whitespace


Version published
Weekly downloads
3.8M
decreased by-13.79%
Maintainers
2
Weekly downloads
 
Created

What is hast-util-whitespace?

The `hast-util-whitespace` package is a utility for working with whitespace in HAST (Hypertext Abstract Syntax Tree) nodes. HAST is part of the unifiedjs ecosystem, which is used for processing HTML, Markdown, and similar content. This package provides functionality to check if a node is whitespace, which can be useful in various text processing and manipulation tasks in the context of web content.

What are hast-util-whitespace's main functionalities?

Check if a node is whitespace

This feature allows you to check if a given HAST node is composed entirely of whitespace. The function returns `true` if the node is a whitespace node, and `false` otherwise. This can be particularly useful when manipulating or traversing HAST trees, allowing for the exclusion or special handling of whitespace nodes.

var whitespace = require('hast-util-whitespace');

var node = {type: 'text', value: ' '};

if (whitespace(node)) {
  console.log('The node is whitespace.');
} else {
  console.log('The node is not whitespace.');
}

Other packages similar to hast-util-whitespace

Keywords

FAQs

Package last updated on 31 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc